package GameElement;

import java.util.Random;

import PlayerElement.AnalysisReport;

public class GamePlayer {
	private String name, roles;				// Define player name and roles
	private int score;						// Define player score
	private int communicationScore;			// Define player communication score
	private int interactionScore;			// Define player interaction score
	private int understandingScore;			// Define player understanding score
	private int position;					// Define player position on the game board
	private AnalysisReport report;			// Define player performance report

	/**
	 * Constructor to initialize the variables, such as
	 * Player name, roles, position, communication, interaction understanding score.
	 * @param player_name
	 * @param roles
	 */
	public GamePlayer(String player_name, String roles) {
		this.name = player_name;
		this.roles = roles;
		this.position = 0;
		this.communicationScore = 50;
		this.interactionScore = 50;
		this.understandingScore = 50;
	}

	/**
	 * Return the game player name
	 * @return game player name
	 */
	public String getGamePlayerName(){
		return name;
	}
	
	/**
	 * Return the game player role
	 * @return game player role
	 */
	public String getRoles() {
		return roles;
	}
	
	/**
	 * Define the game player initial score
	 */
	public void setInitScore(int scr){
		this.score = scr;
	}
	
	/**
	 * Define the position of player in game board
	 * @param pos
	 */
	public void modifyPosition(int pos){
		position += pos;
		if ( position > 39 )
			position -= 40;
	}
	
	/**
	 * Add score to players
	 * @param score
	 */
	public void modifyScore(int score) {
		this.score += score;
	}
	
	/**
	 * Add communication score to players
	 * @param communicationScore
	 */
	public void modifyCommunicationScore(int communicationScore){
		this.communicationScore += communicationScore;
	}
	
	/**
	 * Return player's communication score
	 * @return player's communication score 
	 */
	public int getCommunicationScore(){
		return communicationScore;
	}
	
	/**
	 * Add communication score to players
	 * @param communicationScore
	 */
	public void modifyInteractionScore(int interactionScore){
		this.interactionScore += interactionScore;
	}
	
	/**
	 * Return player's interaction score
	 * @return player's interaction score 
	 */
	public int getInteractionScore(){
		return interactionScore;
	}
	
	/**
	 * Add communication score to players
	 * @param communicationScore
	 */
	public void modifyUnderstandingScore(int understandingScore){
		this.understandingScore += understandingScore;
	}
	
	/**
	 * Return player's understanding score
	 * @return player's understanding score 
	 */
	public int getUnderstandingScore(){
		return understandingScore;
	}
	
	/**
	 * Return player's score
	 * @return player's score 
	 */
	public int getScore(){
		return score;
	}
	
	/**
	 * Return player's position on game board
	 * @return player's position on game board 
	 */
	public int getPosition() {
		return position;
	}
	
	/**
	 * Request to generate and print the performance report
	 */
	public void getPerformaceReport() {
		int [] performance = {communicationScore, interactionScore, understandingScore};
		report = new AnalysisReport(name, performance);
		report.getRadarChart(report.generateRadarChart());
	}
	
}